using System;
using System.Collections.Generic;
using System.Text;
using MS.Core.Base.Data;
using System.Data;
using System.Data.Common;
using LHS.Core.TableInfo.SetUpCaseRecordForm;
using MS.Core.Constants;

namespace LHS.Core.CaseRecord.DataCommons
{
    public class CommonCaseRecord_Tree : DBBaseData
    {
        public DataTable getCaseRecord_TreeDT(String strCategoryID)
        {
            DataTable dtReturn;
            try
            {
                String strSQL = "SELECT *, " + Convert.ToInt32(GlobalEnumType.Status.HAVE_VALUE).ToString() + " AS " + DBBaseInfo.Hidden_Status + " FROM " + CaseRecord_TreeInfo.TABLENAME;
                strSQL += (strCategoryID == "" ? "" : " WHERE " + CaseRecord_TreeInfo.CRC_ID + " = '" + strCategoryID + "'");
                strSQL += " ORDER BY " + CaseRecord_TreeInfo.CRT_BUILDORDER;
                DbCommand cmd = base.GetDbCommand(CommandType.Text, strSQL);
                dtReturn = base.GetData(cmd, CaseRecord_TreeInfo.TABLENAME);
                if (dtReturn == null)
                    dtReturn = CaseRecord_TreeInfo.GetStructure();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return dtReturn;
        }
    }
}